const express = require('express');
const router = express.Router();
router.get('/', (req, res) => {
    const content = [];
    for(let i = 0; i < 30; i++)
        content.push({
            id: `2019${i}`,
            code: `故障模式编号-${i}`,
            name: `故障模式名称-${i}`,
        });
    res.json({
        message: '',
        payload: {
            content,
        }
    });
});
router.get('/simple', (req, res) => {
    const content = [];
    for(let i = 0; i < 30; i++)
        content.push({
            id: `2019${i}`,
            code: `故障模式编号-${i}`,
            name: `故障模式名称-${i}`,
        });
    res.json({
        message: '',
        payload: {
            content,
        }
    });
});

/**
 * @param {Object} options
 * @param {} options.code 编号
 * @param {} options.name 名称
 * @param {} options.status 状态
 * @param {} options.workItemCategoryId 维修项目分类Id，维修项目所关联的分类或其上层分类Id
 * @param {} options.pageSize 每页数据量
 * @param {} options.pageIndex 指定页
 * @param {} options.sortField 排序字段
 * @param {} options.isDesc 倒序排列
 * @throws {Error}
 * @return {Promise}
 */
router.get('/forCurrentUser', async(req, res, next) => {
    const options = {
        code: req.query.code,
        name: req.query.name,
        status: req.query.status,
        faultModeCategoryId: req.query.faultModeCategoryId,
        pageSize: req.query.pageSize,
        pageIndex: req.query.pageIndex,
        sortField: req.query.sortField,
        isDesc: req.query.isDesc
    };
    const data = {
        message: 'message',
        payload: {
            content: [
                {
                    id: 'id1573',
                    code: 'code1574',
                    name: 'name1575',
                    description: 'description',
                    options: [
                        'update',
                        'abandon',
                    ],
                    rowVersion: 'rowVersion'
                },
                {
                    id: 'id1580',
                    code: 'code1581',
                    name: 'name1582',
                    description: 'description',
                    options: [
                        'update',
                        'abandon',
                    ],
                    rowVersion: 'rowVersion'
                }
            ],
            pageIndex: null,
            pageSize: null,
            sort: null,
            totalElements: 50,
            totalPages: null
        }
    };
    res.json(data);
});
/**
 * @param {Object} options
 * @throws {Error}
 * @return {Promise}
 */
router.post('/', async(req, res, next) => {
    const options = {
    };
    const data = {
        message: 'message'
    };
    res.json(data);
});
/**
 * @param {Object} options
 * @throws {Error}
 * @return {Promise}
 */

router.put('/:id', async(req, res, next) => {
    const options = {
    };
    const data = {
        message: 'message'
    };
    res.json(data);
});
/**
 * @param {Object} options
 * @param {} options.id 维修项目Id
 * @throws {Error}
 * @return {Promise}
 */
router.put('/:id/abandon', async(req, res, next) => {
    const options = {
        id: req.params.id
    };
    const data = {
        message: 'message'
    };
    res.json(data);
});
router.post('/import/forCurrentUser', async(req, res, next) => {
    const options = {
    };
    const data = {
        message: 'message'
    };
    res.json(data);
});
/**
 * @param {Object} options
 * @param {} options.code 编号
 * @param {} options.name 名称
 * @param {} options.status 状态
 * @param {} options.workItemCategoryId 维修项目分类Id，维修项目所关联的分类或其上层分类Id
 * @param {} options.sortField 排序字段
 * @param {} options.isDesc 倒序排列
 * @throws {Error}
 * @return {Promise}
 */
router.get('/export/forCurrentUser', async(req, res, next) => {
    const options = {
        code: req.query.code,
        name: req.query.name,
        workItemCategoryId: req.query.workItemCategoryId,
        sortField: req.query.sortField,
        isDesc: req.query.isDesc
    };
    const data = {
        message: 'message',
        payload: 'payload'
    };
    res.json(data);
});
module.exports = router;
